<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>阳光运动</title>
</head>
<style>
	body {
		font-size: 12px;
		font-family: Arial;
		margin: 0px;
		padding: 0px;
	}
	
	a {
		color: #999;
	}
	
	.greenColor {
		color: darkgreen !important;
	}
	
	nav.top a:hover {
		color: darkgreen;
		text-decoration: none;
	}
	
	nav.top {
		background-color: ghostwhite;
		padding-top: 5px;
		padding-bottom: 5px;
		border-bottom: 1px solid #e7e7e7;
		margin: 0px;
	}
	
	nav.top span,
	nav.top a {
		color: #999;
		margin: 0px 0px 0px 10px;
		text-decoration: none;
	}
	
	.pull-right {
		float: right;
	}
	
	div.boughtDiv {
		max-width: 1013px;
		margin: 10px auto;
	}
	
	table.orderListItemTable {
		border: 2px solid #ECECEC;
		width: 100%;
		margin: 20px 0px;
		font-size: 12px;
	}
	
	table.orderListItemTable:hover {
		border: 2px solid #aaa !important;
	}
	
	table.orderListItemTable td {
		padding: 8px 10px;
	}
	
	tr.orderListItemFirstTR {
		background-color: #F1F1F1;
	}
	
	td.orderItemDeleteTD {
		text-align: right;
	}
	
	span.orderListItemDelete {
		display: inline-block;
		margin: 0px 10px;
		color: #999999;
		font-size: 16px;
	}
	
	div.orderListItemProductLinkOutDiv {
		position: relative;
		height: 80px;
	}

	div.orderListItemProductPrice {
		color: #3C3C3C;
		font-size: 14px;
	}
	
	td.orderListItemNumberTD {
		text-align: center;
	}
	
	td.orderItemOrderInfoPartTD {
		border: solid 1px #ECECEC;
	}
	
	span.orderListItemNumber {
		color: #3C3C3C;
	}
	
	td.orderListItemProductRealPriceTD {
		text-align: center;
	}
	
	div.orderListItemProductRealPrice {
		color: #3C3C3C;
		font-size: 14px;
		font-weight: bold;
	}

	td.orderListItemButtonTD {
		text-align: center;
	}
	
	button.orderListItemReview {
		border: 1px solid #DCDCDC;
		background-color: #fff;
		border-radius: 2px;
		color: #3C3C3C;
		font-size: 12px;
		font-weight: bold;
		padding: 6px 12px;
	}
	
	button.orderListItemReview:hover {
		border-color: #C40000;
		color: #C40000;
	}
	
	button.orderListItemConfirm {
		background-color: #66B6FF;
		border-radius: 2px;
		color: white;
		font-size: 12px;
		font-weight: bold;
		border-width: 0px;
		padding: 6px 12px;
	}
	
	button.orderListItemConfirm:hover {
		background-color: #118ADB;
	}
	
	a {
		color: #999;
	}
	
	a:hover {
		text-decoration: none;
		color: #C40000;
	}
</style>
<script type="text/javascript">
    	 window.onload=function(){
        	 xmlhttp = new XMLHttpRequest();
        	 xmlhttp.onreadystatechange = function(){
        			if(xmlhttp.readyState==4) {
        		  	    if(xmlhttp.status==200) {
        		  	    	var respTxt = xmlhttp.responseText;
      				      	window.eval("var arr="+respTxt);
      				    	var html='';
      				    	for(var i=0;i<arr.length;i++){
      				    	    html+='<table class="orderListItemTable"><tbody><tr class="orderListItemFirstTR"><td colspan="3">';
      				    	    html+='<span>书籍</span></td><td colspan="1"><span>评分</span></td></tr>';   
      				    	    html+='<tr class="orderItemProductInfoPartTR">'+'<td class="orderItemProductInfoPartTD"><img width="80" height="80" src="'+arr[i].book.url+'"></td>';			    
      				    	    html+='<td class="orderItemProductInfoPartTD" colspan="2">'+'<div class="orderListItemProductLinkOutDiv">'+'<a href="<%=request.getContextPath()%>/index/bookdetail.jsp?id='+arr[i].book.book_id+'">'+arr[i].book.title+'</a></div></td>';
      				    	    html+='<td width="100px" valign="top" class="orderListItemNumberTD orderItemOrderInfoPartTD" rowspan="1">';
      				    	    if(arr[i].score==0)html+='<div id="score" style="color: yellow;font-size:250%;">☆☆☆☆☆</div>';
      				    	    else if(arr[i].score==1||arr[i].score==2)html+='<div id="score" style="color: yellow;font-size:250%;">★☆☆☆☆</div>';
      				    	    else if(arr[i].score==3||arr[i].score==4)html+='<div id="score" style="color: yellow;font-size:250%;">★★☆☆☆</div>';
      				    	    else if(arr[i].score==5||arr[i].score==6)html+='<div id="score" style="color: yellow;font-size:250%;">★★★☆☆</div>';
      				    	    else if(arr[i].score==7||arr[i].score==8)html+='<div id="score" style="color: yellow;font-size:250%;">★★★★☆</div>';
      				    	    else if(arr[i].score==9||arr[i].score==10)html+='<div id="score" style="color: yellow;font-size:250%;">★★★★★</div>';
      				    	    html+='<span class="orderListItemNumber">'+arr[i].score+'分</span></td>';
      				    	    html+='</tbody>';
      				        }
      				    	html+='</table>';
      				        document.getElementById("c").innerHTML=html;
        			    }
        		     }
        	 }
        	 xmlhttp.open("get","<%=request.getContextPath()%>/ShowRating");
        	 xmlhttp.send(null); 
         }
</script>
<body>
	<nav class="top">
			<a href="<%=request.getContextPath() %>/index/index.jsp" >首页</a>

			<span>欢迎来到鹿马书城~</span>
			
			<%
			if(request.getSession().getAttribute("identity")!=null){
				int identity=(int)request.getSession().getAttribute("identity");
				if(identity==1){
					%>
					<a href="<%=request.getContextPath()%>/exit">退出登录</a>
					<span class="pull-right">
		            <a href="<%=request.getContextPath()%>/index/orderlist.jsp">查看订单</a>
					</span><%
				}
				else{%>
					<a href="<%=request.getContextPath()%>/exit">退出登录</a>
					<span class="pull-right">
					<a href="<%=request.getContextPath()%>/index/ratinglist.jsp">我的评分</a>
		            <a href="<%=request.getContextPath()%>/index/orderlist.jsp">我的订单</a>
		            <a href="<%=request.getContextPath() %>/showcart">购物车</a>
					</span><%
				}
			}
			else{
			%>
				<a href="<%=request.getContextPath()%>/enter">请登录</a>
				<a href="<%=request.getContextPath()%>/register">免费注册</a><%
			}
			%>
		</nav>
		
	<div class="boughtDiv">
		<div class="orderListItem">
			<div id="c"></div>
		</div>
	</div>
</body>
</html>